<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Obtain a proxy for a service</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="sca.createdataobject.html">SCA::createDataObject</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="sca-localproxy.createdataobject.html">SCA_LocalProxy::createDataObject</a></div>
 <div class="up"><a href="ref.sca.html">SCA 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="sca.getservice" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SCA::getService</h1>
  <p class="verinfo">(PECL SDO &gt;= 0.5.0)</p><p class="refpurpose"><span class="refname">SCA::getService</span> &mdash; <span class="dc-title">
   Obtain a proxy for a service
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-sca.getservice-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> 
   <span class="methodname"><strong>SCA::getService</strong></span>
    ( <span class="methodparam">
    <span class="type">string</span>
     <code class="parameter">$target</code>
   </span>
   [, <span class="methodparam">
    <span class="type">string</span>
     <code class="parameter">$binding</code>
   </span>   
   [, <span class="methodparam">
    <span class="type">array</span>
     <code class="parameter">$config</code>
   </span>   
  ]] )</div>


  <div class="warning"><strong class="warning">Warning</strong><p class="simpara">此函数是<em class="emphasis">实验性</em>的。此函数的表象，包括名称及其相关文档都可能在未来的
PHP 发布版本中未通知就被修改。使用本函数风险自担 。</p></div>

  <p class="para"> Examine the target and initialize and return a proxy of the appropriate 
  sort. If the target is for a local PHP component the returned proxy will be an 
  SCA_LocalProxy. If the target is for a WSDL file, the returned proxy will be a 
  SCA_SoapProxy.</p>

 </div>

 <div class="refsect1 parameters" id="refsect1-sca.getservice-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
  <dl>

    
     <dt>

      <em><code class="parameter">target</code></em>
     </dt>

     <dd>

      <p class="para"> An absolute or relative path to the target service or service 
      description (e.g. a URL to a json-rpc service description, a PHP 
      component, a WSDL file, and so on.). A relative path, if specified, 
      is resolved relative to the location of the script issuing the
       <span class="function"><strong>getService()</strong></span> call, and not against the include_path 
       or current working directory.</p>
     </dd>

    
    
     <dt>

      <em><code class="parameter">binding</code></em>
     </dt>

     <dd>

      <p class="para"> The binding (i.e. protocol) to use to communicate with the service 
      (e.g binding.jsonrpc for a json-rpc service).  Note, some service types 
      can be deduced from the target parameter (e.g. if the target parameter 
      ends in .wsdl then SCA will assume binding.soap).  Any binding which 
      can be specified in an annotation can be specified here.  For example 
      &#039;binding.soap&#039; is equivalent to the &#039;@binding.soap&#039; annotation.</p>
     </dd>

    
    
     <dt>

      <em><code class="parameter">config</code></em>
     </dt>

     <dd>

      <p class="para"> Any additional configuration properties for the binding (e.g. 
      array(&#039;location&#039; =&gt; &#039;http://example.org&#039;)).  Any binding configuration 
      which can be specified in an annotation can be specified here.  For 
      example, &#039;location&#039; is equivalent to the &#039;@location&#039; annotation to 
      configure the location of a target soap service. </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-sca.getservice-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   The SCA_LocalProxy or SCA_SoapProxy.
  </p>
 </div>


 


 


 <div class="refsect1 examples" id="refsect1-sca.getservice-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5192">
    <p><strong>Example #1 An <span class="function"><strong>SCA::getService()</strong></span> example</strong></p>
    <div class="example-contents"><p>
    This example shows how to get a proxy to an email soap service described 
    by <var class="filename">EmailService.wsdl</var> and located at 
    <var class="filename">http://example.org</var>.
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">include&nbsp;</span><span style="color: #DD0000">'SCA/SCA.php'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$service&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">SCA</span><span style="color: #007700">::</span><span style="color: #0000BB">getService</span><span style="color: #007700">(</span><span style="color: #DD0000">'EmailService.wsdl'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'binding.soap'</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">'location'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'http://example.org'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$service</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">(...);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
   </div>
  </p>
 </div>



 


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="sca.createdataobject.html">SCA::createDataObject</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="sca-localproxy.createdataobject.html">SCA_LocalProxy::createDataObject</a></div>
 <div class="up"><a href="ref.sca.html">SCA 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
